package com.qijia.travel.dao;

import com.qijia.travel.dao.impl.BaseDaoImpl;

public class SingletonDaoFactory {
	private volatile static BaseDAO baseDao;

	private SingletonDaoFactory() {
	}

	public static BaseDAO createDAO() throws TravelDbException {
		if (baseDao == null) {
			synchronized (SingletonDaoFactory.class) {// 双层锁确保同步多线程的正确执行
				if (baseDao == null) {
					baseDao = new BaseDaoImpl();
				}
			}
		}
		return baseDao;
	}
}
